UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VJSL21uo9opO6PYaNUihCpnz/EqKBNAiG25Loyzt+sE=' 
WHERE 
  key_id = 'f92905e58d35f8230f8de9749616ee79ac822b378e3ec4fda28d09c4da3743d8' 
  AND (
    token = 'VJSL21uo9opO6PYaNUihCpnz/EqKBNAiG25Loyzt+sE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037