UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NBrUUqaSSZvE7m4burwSO13H9zfUp+4Leee1nsj+qbQ='
WHERE
key_id = 'c8bd2a1a0f63e9f24ffe0be6fd6fe1b87a2eb6970696376298a13e0a8e35fd0d'
AND (
token = 'NBrUUqaSSZvE7m4burwSO13H9zfUp+4Leee1nsj+qbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)