UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ctA9VtRw5i6YksDS6VBctavFgfuwZ5GGwojpDq+tE+A='
WHERE
key_id = '7548a83e63a3b509f63ada922ae5563fb9a1bbf6657de69a89cf611b32c5c38e'
AND (
token = 'ctA9VtRw5i6YksDS6VBctavFgfuwZ5GGwojpDq+tE+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)