UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c6IiR+Gm7dl3Af0JgSMAfFSDkZC71DmZf32QUzhXmhw='
WHERE
key_id = '47b5732b055acb9911b9ee64837255acecce85f4d7cc800bba7722219999e7fc'
AND (
token = 'c6IiR+Gm7dl3Af0JgSMAfFSDkZC71DmZf32QUzhXmhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)