UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XmEfNVyRv2Ytjo3WR4saa39DhBTVOrsLh4Sbf+x4nLk='
WHERE
key_id = '8f572151afdd2b7f8d25ceb5e9988553bd8e15ef2b2089a39964efe06ef1e4fc'
AND (
token = 'XmEfNVyRv2Ytjo3WR4saa39DhBTVOrsLh4Sbf+x4nLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)