UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SRJz8poI4zrHvXau686HWwLJccwsMggMTKBt37+haJQ='
WHERE
key_id = '286c8b32efba6bb22530680e5f8c15f5e1f85d94eb4e102a3fafe72deb70843d'
AND (
token = 'SRJz8poI4zrHvXau686HWwLJccwsMggMTKBt37+haJQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)