UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o3Ysr7Zm9KvocxBbdZboxNHLSS0scIaWHxuv522CzsE='
WHERE
key_id = '2fba8790148fa177b9aed3991eb4e666b382696364602972e201c0ac3d93a961'
AND (
token = 'o3Ysr7Zm9KvocxBbdZboxNHLSS0scIaWHxuv522CzsE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)