UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AqGPA5BxEcIznE/dj9uf5Q3gG/y8POiz0hqnJ3QEVd4='
WHERE
key_id = 'b0f6a92e52131f7a2dc8ea1b7d9a6daccd19b068712bc0585e4e40f0d9fac7bd'
AND (
token = 'AqGPA5BxEcIznE/dj9uf5Q3gG/y8POiz0hqnJ3QEVd4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)