UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N4FwaFm+HVfvPXwisyWDdYZhW8UMBThfgf3D3ZdSGU8='
WHERE
key_id = 'f294c269911480364289a4ae93041d937345302d162e634d846d9241413c81b2'
AND (
token = 'N4FwaFm+HVfvPXwisyWDdYZhW8UMBThfgf3D3ZdSGU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)