UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CHCRDMsH2wmOsz1441aKpXJStw2dHveU01MRiXa/GfM='
WHERE
key_id = '051de169a7c52119238f9293a04d2955535d137204d1d1925c1d55f34e8e7f0f'
AND (
token = 'CHCRDMsH2wmOsz1441aKpXJStw2dHveU01MRiXa/GfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)