UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wLnU+QJW+tlEAxalz4rcgWOMOk7EicGZaTvPf6Adh4Y='
WHERE
key_id = 'f1bb9546b6cb3bdb72f16ef0463d7014c4972d681a2307d639d6194c32ebbe92'
AND (
token = 'wLnU+QJW+tlEAxalz4rcgWOMOk7EicGZaTvPf6Adh4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)