UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zjJP1IEivdc0H8vm4gYXeGjA/QW67jJW99JQPBJifPE=' 
WHERE 
  key_id = 'a0259e4259fea223e338c3749a132091e6aa30ae1d010988724f7a23253f4ac5' 
  AND (
    token = 'zjJP1IEivdc0H8vm4gYXeGjA/QW67jJW99JQPBJifPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045