UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7iq966zExInT1PUMtXKrY2yVRjkI9nkGwvynx8waAXE=' 
WHERE 
  key_id = 'b18e0bf4ef3ada0b9f4d7bd107ea39ff7fbd1153193ca6fac611bfd67c3b9986' 
  AND (
    token = '7iq966zExInT1PUMtXKrY2yVRjkI9nkGwvynx8waAXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038