UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v40BHvfRviJ6VI4sojDQCNBptFPuDZknzGUjahBLEu0='
WHERE
key_id = 'a2bfc5e344c35f9070df0d99c6465b5d4ccfa7d0420e37f40c74e58328aeaab1'
AND (
token = 'v40BHvfRviJ6VI4sojDQCNBptFPuDZknzGUjahBLEu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)