UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CrI1JPl7UZNlEgfdQA0WJC5H//fmicA4SxoLzlz8PTU=' 
WHERE 
  key_id = '54a04780fb38dc612e4d1966607ba75a2486ba68cd30ac44eab068e382e268f7' 
  AND (
    token = 'CrI1JPl7UZNlEgfdQA0WJC5H//fmicA4SxoLzlz8PTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038