UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTqVinrO3J4Jx/NLMKKd5jEGjkI7O0PRNTcMGcf4xDk='
WHERE
key_id = '897602bc069b1094f7413b225bee185cc905157bfc985bf3d36635c509f57881'
AND (
token = 'qTqVinrO3J4Jx/NLMKKd5jEGjkI7O0PRNTcMGcf4xDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)