UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fiwbOHXdIaeSI4+j+KYy2dPmq5y3NJVRZzeNxkX+HhM='
WHERE
key_id = '29f674771f9f53ac8008e0f7adde8c7e71f532d4d0320a1b2aa963a7a47d5e5d'
AND (
token = 'fiwbOHXdIaeSI4+j+KYy2dPmq5y3NJVRZzeNxkX+HhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)