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

Query time 0.00039