UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8MoNe2blPr5fhQehWyPuUtiO/XM02tCGP08kZ6+tdV8=' 
WHERE 
  key_id = '296b62dd76a73f3b3914bfec0b6c47db5137539ba9c0321262268312e6e840eb' 
  AND (
    token = '8MoNe2blPr5fhQehWyPuUtiO/XM02tCGP08kZ6+tdV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045