UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zJLXuB5G4LdveayAtvA1JdqMiHuhwr7LiY4hlL7jifM='
WHERE
key_id = 'a9d38ab243e648e65992e38621021b61dc6407cb71ebc2d6be18fc222f5ba28f'
AND (
token = 'zJLXuB5G4LdveayAtvA1JdqMiHuhwr7LiY4hlL7jifM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)