UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CoikKUyn1IQuAY+y622MsHQYa6b1RZCOuKkdiuLnmA4='
WHERE
key_id = '377fb09699cb06a51d063d00fce74e05a64ab729b0f5f5720cce033c696dc611'
AND (
token = 'CoikKUyn1IQuAY+y622MsHQYa6b1RZCOuKkdiuLnmA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)