UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vd7Vh69mQl6HDvJOy3BwWdUSHv9eZFnUqDSxkVlcD7Q='
WHERE
key_id = '7a912d939475fe623770ea50a2c6a63e802d65b2baed9a89f352963f597c190a'
AND (
token = 'Vd7Vh69mQl6HDvJOy3BwWdUSHv9eZFnUqDSxkVlcD7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)