UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K630xhbZw4aYWIgJq0HYBzQeh13YFzEL+N9EonTPyrI='
WHERE
key_id = 'b23a7cb3ce6173a3ad8f10cedab5a4ebbd8413759ab8b0c318a551e28126f583'
AND (
token = 'K630xhbZw4aYWIgJq0HYBzQeh13YFzEL+N9EonTPyrI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)