UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6wNEmMkWTpEDdsKyD/RS1wls4DFDl8FCKwhYZGnIt1U='
WHERE
key_id = 'b9169536ed64eb874ea72dbc362d71d22b560c3ee5e2fcc405a5ad11f7bbf5b8'
AND (
token = '6wNEmMkWTpEDdsKyD/RS1wls4DFDl8FCKwhYZGnIt1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)