UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWiQU5IcyJSvtD+RQoG76kW7mBeL5cK/BEYgSrgBsxI=' 
WHERE 
  key_id = 'e52161a7631f6346bf1c72cfb3180d6f6ffebb0f5d4af853b3164ff849483ffc' 
  AND (
    token = 'qWiQU5IcyJSvtD+RQoG76kW7mBeL5cK/BEYgSrgBsxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038