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