UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AP524rpuKkjxFmteBg03Z94fWJLpGEpTYziPKhVtBq4=' 
WHERE 
  key_id = 'd1ad3be5c9ed0d35df96da3c32efc4243c53785bd5dc3f2c760ee5d182ff5895' 
  AND (
    token = 'AP524rpuKkjxFmteBg03Z94fWJLpGEpTYziPKhVtBq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024