UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'swJLeLwFpNg4DKBV5XvcQHvUkVgcgsaQNBIoXwSSf0c='
WHERE
key_id = '5bee1394ace430fa33eb01d8c5ac89790b6c71964dd7303df3cb12ae1ae49bb3'
AND (
token = 'swJLeLwFpNg4DKBV5XvcQHvUkVgcgsaQNBIoXwSSf0c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)