UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tZ6PP7tKl5zji5VUpMZkauADirkkMZYgAoJwNy4o9CM='
WHERE
key_id = '9437407b7e4a12a71085f1e76f6341406b7014101f7cd49db030365a01e58fd6'
AND (
token = 'tZ6PP7tKl5zji5VUpMZkauADirkkMZYgAoJwNy4o9CM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)