UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XOytISEjQbG5gi32aYQhCb4syLZA1q8E0oZiZL+SmZQ='
WHERE
key_id = 'b790552c163c19e84160af611f2f249e6a6e2422da421195905c42e7c416b9be'
AND (
token = 'XOytISEjQbG5gi32aYQhCb4syLZA1q8E0oZiZL+SmZQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)