UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0uqrrNQu7ary5QUOFnghhji7o6OXAvqwaigqg3J6tc='
WHERE
key_id = '7640f7ccecc9adb08485efb0c7737225b16cfa010edc563734014586fe18eb2a'
AND (
token = 'i0uqrrNQu7ary5QUOFnghhji7o6OXAvqwaigqg3J6tc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)