UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ec5mU4omSDwWXpP6DF7qezcbYTOSfJgAoL7/y8Q59ik='
WHERE
key_id = 'bb972035a75171f27e7fd2b4b254c99273d7dd5a2a345c9b5df9dd77b21b9000'
AND (
token = 'Ec5mU4omSDwWXpP6DF7qezcbYTOSfJgAoL7/y8Q59ik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)